	.text
	.align	3
print_str:
	.string	"0x%x\n"
	.text
	.align	1
	.globl	fun
	.type	fun, @function
fun:
	# allocate stack, and save some registers
	addi		sp, sp, -32
	sd		s0, 16(sp)
	sd		s1, 8(sp)
	sd		ra, 24(sp)

	# from main fuction, a0 is 5
	# fcvt convert 5 to 5.0, and saved to fa5
	fcvt.s.wu	fa5, a0
	# 5.0 moved to s1 directly
	fmv.x.s		s1, fa5
	# save 5.0 from s1 to s0
	mv		s0, s1

	# print s1's binary format, it's 5.0's binary format
	# so, the following printf will print 5.0's binary format: 0x40a00000
	mv		a1, s1
	lla		a0, print_str
	call		printf@plt

	# mov s0 to fa5 directly, fa5 is 5.0 now
	fmv.s.x		fa5, s0
	# fcvt convert 5.0 to 5, and saved to a1, a1 is 5 now
	# so the following printf will print 5: 0x5
	fcvt.wu.s	a1, fa5

	lla		a0, print_str
	call		printf@plt

	ld		ra, 24(sp)
	ld		s0, 16(sp)
	ld		s1, 8(sp)
	addi		sp, sp, 32
	jr		ra
	.size		fun, .-fun

	.align		1
	.globl		main
	.type		main, @function
main:
	addi		sp, sp, -16
	li		a0, 5
	sd		ra, 8(sp)
	call		fun
	ld		ra, 8(sp)
	li		a0, 0
	addi		sp, sp, 16
	jr		ra
	.size		main, .-main
